<template>
  <div class="width-style guide">
    <el-row :gutter="20">
      <el-col :span="9">
        <div class="grid-content">
          <ModuleTitle moduleName="传统医学养生" innerModuleName="艾灸疗法" introduce="我是简介"/>
        </div>
      </el-col>
      <el-col :span="9">
        <div class="grid-content guide-img-box">
          <img src="@/assets/images/moxibustion.jpg" class="guide-img" />
        </div>
      </el-col>
      <el-col :span="6">
        <div class="grid-content">
          <Download />
        </div>
      </el-col>
    </el-row>
<!--    <el-row :gutter="20">-->
<!--      <el-col :span="18">-->
<!--        <div class="grid-content">-->
<!--          <InnerModuleLong innerModuleName="盒灸" :list="boxList"  :picSrc="require('@/assets/images/MoxibustionBox.jpg')" routeName="/traditionalmedicalcare/moxibustion/box"/>-->
<!--          <InnerModuleLong innerModuleName="悬灸" :list="suspendedList"  :picSrc="require('@/assets/images/MoxibustionSuspended.jpg')" routeName="/traditionalmedicalcare/moxibustion/suspended"/>-->
<!--          <InnerModuleLong innerModuleName="隔姜灸" :list="gingerList" :picSrc="require('@/assets/images/MoxibustionGinger.jpg')" routeName="/traditionalmedicalcare/moxibustion/ginger"/>-->
<!--          <InnerModuleLong innerModuleName="灸法演进" :list="evolutionList" :picSrc="require('@/assets/images/MoxibustionEvolution.jpg')" routeName="/traditionalmedicalcare/moxibustion/evolution"/>-->
<!--        </div>-->
<!--      </el-col>-->
<!--      <el-col :span="6">-->
<!--        <div class="grid-content">-->
<!--          <ModuleAdviser :doctorList="doctorList"/>-->
<!--        </div>-->
<!--      </el-col>-->
<!--    </el-row>-->
    <el-row :gutter="20">
      <el-col :span="18">
        <div class="grid-content">
          <div class="acticle-show-box">
            <span class="article-show">文章展示</span>
          </div>
          <ArticleShow :articleList="articleList" :total="total" catalogue="37"/>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="grid-content">
          <ModuleAdviser :doctorList="doctorList"/>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import Download from "@/components/download.vue";
import ModuleAdviser from "@/components/moduleAdviser.vue";
import ArticleShow from '@/components/articleShow.vue'
import {renderTime} from '@/utils/tools.js'
export default {
  layout: "homeLayout",
  components: { Download, ModuleAdviser,ArticleShow},
  async asyncData({ app }) {
    let res = await app.api.reqGeneralAllByCatalogue(37);
    if (res.code === 200) {
      for (let item of res.rows) {
        item.publishTime = renderTime(item.publishTime);
      }
    }
    //获取医生等列表
    let doctorRes=await app.api.reqAllDoctor();
    if(doctorRes.code===200){
      for(let doctor of doctorRes.rows){
        doctor.doctorAvatar=app.api.BASEURL+doctor.doctorAvatar
      }
    }
    // //获取当类下的子分类的文章
    // let boxRes = await app.api.reqGeneralAllByCatalogue(116);//盒灸
    // if (boxRes.code === 200) {
    //   for (let item of boxRes.rows) {
    //     item.publishTime = renderTime(item.publishTime);
    //   }
    // }
    // let suspendedRes = await app.api.reqGeneralAllByCatalogue(117);//生活习惯
    // if (suspendedRes.code === 200) {
    //   for (let item of suspendedRes.rows) {
    //     item.publishTime = renderTime(item.publishTime);
    //   }
    // }
    // let gingerRes = await app.api.reqGeneralAllByCatalogue(118);//活动指南
    // if (gingerRes.code === 200) {
    //   for (let item of gingerRes.rows) {
    //     item.publishTime = renderTime(item.publishTime);
    //   }
    // }
    // let evolutionRes = await app.api.reqGeneralAllByCatalogue(119);//活动指南
    // if (evolutionRes.code === 200) {
    //   for (let item of evolutionRes.rows) {
    //     item.publishTime = renderTime(item.publishTime);
    //   }
    // }
    return {
      // articleList: res.rows,
      // total:res.total,
      // doctorList:doctorRes.rows,
      // boxList:boxRes.rows,
      // suspendedList:suspendedRes.rows,
      // gingerList:gingerRes.rows,
      // evolutionList:evolutionRes.rows,
      articleList: res.rows,
      total:res.total,
      doctorList:doctorRes.rows,
    }
  },
};
</script>

<style scoped lang="less">
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.grid-content {
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
.guide {
  .guide-img-box {
    height: 260px;
    .guide-img {
      width: 100%;
      height: 100%;
    }
  }
  .guide-name {
    margin-top: 10px;
    font-size: 22px;
    .icon-guide {
      font-size: 26px;
      color: @themeColor;
      vertical-align: bottom;
    }
  }
  .guide-introduce {
    margin: auto;
    margin-top: 50px;
    width: 70%;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
  }
  .acticle-show-box {
    text-align: left;
    .article-show {
      font-size: 20px;
      border-left: 3px solid @themeColor;
      padding-left: 5px;
    }
  }
}
</style>
